<template>
  <div class="el-custom-from" v-loading="formLoading">
    <el-tabs
      v-model="activeName"
      class="node-tabs-kts"
      @tab-click="formInit"
      ref="node-tabs-kts"
    >
      <el-tab-pane name="business">
        <template #label>
          <div>
            <span class="font_16px font_Title">
              <i class="el-icon-lx-calendar"></i>
              {{ this.$t("flowi18n.flow_link_business_property") }}
            </span>
          </div>
        </template>
        <div id="From_div_style">
          <el-container class="custom-el-main">
            <el-main id="el-custom-form-main" style="margin-right: 10px">
              <div class="container form-container">
                <el-scrollbar>
                  <el-form
                    label-width="100px"
                    class="demo-ruleForm"
                    size="mini"
                    :model="linkproperty"
                  >
                    <el-col style="width: 50%">
                      <el-form-item
                        size="small"
                        :label="$t('flowi18n.flow_line_property_CnName')"
                        class="el-from-custom-item"
                      >
                        <el-input v-model="linkproperty.meta.cnName"></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col style="width: 50%">
                      <el-form-item
                        size="small"
                        :label="$t('flowi18n.flow_line_property_EnName')"
                        class="el-from-custom-item"
                      >
                        <el-input v-model="linkproperty.meta.enName"></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col style="width: 100%">
                      <el-form-item
                        size="small"
                        label="分支标识"
                        class="el-from-custom-item"
                        prop="branchTag"
                        :rules="[
                          {
                            pattern: '^([a-zA-Z0-9_]){1,20}$',
                            message: '请输入英文字符和数字组成的编码!',
                            trigger: 'blur',
                          },
                        ]"
                      >
                        <el-input v-model="linkproperty.meta.branchTag"></el-input>

                        <el-alert
                          title="分支标识仅在并行分支中使用！"
                          type="warning"
                          show-icon
                          :closable="false"
                        />
                      </el-form-item>
                    </el-col>
                    <el-col style="width: 100%">
                      <div
                        class="title"
                        v-for="element in businessConditions"
                        :key="element.id"
                      >
                        <el-card
                          :class="element.usable ? 'box-card' : 'box-card-danger'"
                          style="min-height: 100px"
                        >
                          <template #header>
                            <div
                              :class="
                                element.usable ? 'card-header' : 'card-header-danger'
                              "
                            >
                              <el-select
                                class="el-flow-line-field-select"
                                size="mini"
                                :placeholder="
                                  $t('formi18n.field_property_selectType_select')
                                "
                                v-model="element.areaLk"
                              >
                                <el-option
                                  value
                                  :label="$t('formi18n.field_property_selectType_select')"
                                ></el-option>
                                <el-option value="(" label="("></el-option>
                              </el-select>
                              <span class="el-field-area-text">
                                <i class="el-icon-postcard"></i>
                                {{
                                  $i18n.locale === "zh-cn"
                                    ? element.areaCNName
                                    : element.areaENName
                                }}
                              </span>
                              <el-tooltip
                                placement="right-start"
                                v-if="element.mainTable == ''"
                                effect="light"
                              >
                                <template #content>
                                  <el-tag
                                    effect="dark"
                                    size="mini"
                                    style="margin-left: 5px; margin-top: 5px"
                                    :type="element.usable ? '' : 'danger'"
                                  >
                                    {{ $t("formi18n.form_tables") }}：{{
                                      element.areaCNName
                                    }}
                                  </el-tag>
                                  <br />
                                  <el-tag
                                    effect="dark"
                                    size="mini"
                                    style="margin-left: 5px; margin-top: 5px"
                                    :type="element.usable ? '' : 'danger'"
                                  >
                                    {{ $t("formi18n.form_tables_en") }}：{{
                                      element.areaENName
                                    }}
                                  </el-tag>
                                  <br />
                                  <el-tag
                                    effect="dark"
                                    size="mini"
                                    style="margin-left: 5px; margin-top: 5px"
                                    :type="element.usable ? '' : 'danger'"
                                  >
                                    {{ $t("formi18n.form_main") }}：{{
                                      element.tableCode
                                    }}
                                  </el-tag>
                                </template>
                                <el-tag
                                  size="mini"
                                  :type="element.usable ? '' : 'danger'"
                                  style="margin-left: 5px"
                                  effect="dark"
                                  >{{ $t("formi18n.form_main") }}</el-tag
                                >
                              </el-tooltip>
                              <el-tooltip placement="right-start" v-else effect="light">
                                <template #content>
                                  <el-tag
                                    effect="dark"
                                    size="mini"
                                    style="margin-left: 5px; margin-top: 5px"
                                    :type="element.usable ? 'warning' : 'danger'"
                                  >
                                    {{ $t("formi18n.form_tables") }}：{{
                                      element.mainTableName
                                    }}
                                  </el-tag>
                                  <br />
                                  <el-tag
                                    effect="dark"
                                    size="mini"
                                    style="margin-left: 5px; margin-top: 5px"
                                    :type="element.usable ? 'warning' : 'danger'"
                                  >
                                    {{ $t("formi18n.form_tables_en") }}：{{
                                      element.mainTableENName
                                    }}
                                  </el-tag>
                                  <br />
                                  <el-tag
                                    effect="dark"
                                    size="mini"
                                    style="margin-left: 5px; margin-top: 5px"
                                    :type="element.usable ? 'warning' : 'danger'"
                                  >
                                    {{ $t("formi18n.form_main") }}：{{
                                      element.mainTable
                                    }}
                                  </el-tag>
                                </template>
                                <el-tag
                                  effect="dark"
                                  size="mini"
                                  style="margin-left: 5px"
                                  :type="element.usable ? 'warning' : 'danger'"
                                  >{{ $t("formi18n.form_child_table") }}</el-tag
                                >
                              </el-tooltip>
                            </div>
                          </template>
                          <el-scrollbar style="height: 230px">
                            <el-form size="mini">
                              <div
                                v-for="(item, index) in element.conditions"
                                :key="index"
                              >
                                <el-col
                                  :class="
                                    element.usable
                                      ? 'el-field-area-close'
                                      : 'el-field-area-close-danger'
                                  "
                                  :style="'width:100%'"
                                >
                                  <el-form-item
                                    label-position="left"
                                    label-width="2px"
                                    :class="
                                      element.usable
                                        ? 'el-feild-fields-item'
                                        : 'el-feild-fields-delete-item '
                                    "
                                  >
                                    <el-select
                                      class="el-flow-line-field-select"
                                      size="mini"
                                      :placeholder="
                                        $t('formi18n.field_property_selectType_select')
                                      "
                                      v-model="item.fieldLk"
                                    >
                                      <el-option
                                        value
                                        :label="
                                          $t('formi18n.field_property_selectType_select')
                                        "
                                      ></el-option>
                                      <el-option value="(" label="("></el-option>
                                    </el-select>
                                    <el-select
                                      style="width: 140px"
                                      class="el-flow-line-field-select"
                                      size="mini"
                                      :placeholder="
                                        $t('formi18n.field_property_selectType_select')
                                      "
                                      v-model="item.fieldKey"
                                      @change="changeFields(item, element.fields)"
                                    >
                                      <el-option
                                        value
                                        :label="
                                          $t('formi18n.field_property_selectType_select')
                                        "
                                      ></el-option>
                                      <el-option
                                        v-for="field in element.fields"
                                        :key="field.fieldKey"
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? field.cnName
                                            : field.enName
                                        "
                                        :value="field.fieldKey"
                                      ></el-option>
                                    </el-select>
                                    <el-select
                                      class="el-flow-line-field-select"
                                      size="mini"
                                      :placeholder="
                                        $t('formi18n.field_property_selectType_select')
                                      "
                                      v-model="item.fieldIn"
                                      :disabled="item.fieldKey == ''"
                                      @change="changeFieldsIn(item)"
                                    >
                                      <el-option
                                        value
                                        :label="
                                          $t('formi18n.field_property_selectType_select')
                                        "
                                      ></el-option>
                                      <el-option
                                        value="="
                                        :label="
                                          this.$i18n.locale === 'zh-cn' ? '等于' : 'Equal'
                                        "
                                      ></el-option>
                                      <el-option
                                        value="!="
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? '不等于'
                                            : 'unEqual'
                                        "
                                      ></el-option>
                                      <el-option
                                        v-if="
                                          item.controlStype == 'number' ||
                                          item.controlStype == 'time' ||
                                          item.controlStype == 'day' ||
                                          item.controlStype == 'month' ||
                                          item.controlStype == 'year' ||
                                          item.controlStype == 'date' ||
                                          item.controlStype == 'datetime'
                                        "
                                        value=">"
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? '大于'
                                            : 'Greater than'
                                        "
                                      ></el-option>
                                      <el-option
                                        v-if="
                                          item.controlStype == 'number' ||
                                          item.controlStype == 'time' ||
                                          item.controlStype == 'day' ||
                                          item.controlStype == 'month' ||
                                          item.controlStype == 'year' ||
                                          item.controlStype == 'date' ||
                                          item.controlStype == 'datetime'
                                        "
                                        value="<"
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? '小于'
                                            : 'Less than'
                                        "
                                      ></el-option>
                                      <el-option
                                        v-if="
                                          item.controlStype == 'number' ||
                                          item.controlStype == 'time' ||
                                          item.controlStype == 'day' ||
                                          item.controlStype == 'month' ||
                                          item.controlStype == 'year' ||
                                          item.controlStype == 'date' ||
                                          item.controlStype == 'datetime'
                                        "
                                        value=">="
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? '大于等于'
                                            : 'Greater than or equal to'
                                        "
                                      ></el-option>
                                      <el-option
                                        v-if="
                                          item.controlStype == 'number' ||
                                          item.controlStype == 'time' ||
                                          item.controlStype == 'day' ||
                                          item.controlStype == 'month' ||
                                          item.controlStype == 'year' ||
                                          item.controlStype == 'date' ||
                                          item.controlStype == 'datetime'
                                        "
                                        value="<="
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? '小于等于'
                                            : 'Less than or equal to'
                                        "
                                      ></el-option>
                                      <el-option
                                        v-if="
                                          item.controlStype == 'text' ||
                                          item.controlStype == 'textarea' ||
                                          item.controlStype == 'employee' ||
                                          item.controlStype == 'organizational' ||
                                          item.controlStype == 'position' ||
                                          item.controlStype == 'parameter' ||
                                          item.controlStype == 'unit'
                                        "
                                        value="in"
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? '值在输入值中'
                                            : 'The value is in the input value'
                                        "
                                      ></el-option>
                                      <el-option
                                        v-if="
                                          item.controlStype == 'text' ||
                                          item.controlStype == 'textarea' ||
                                          item.controlStype == 'employee' ||
                                          item.controlStype == 'organizational' ||
                                          item.controlStype == 'position' ||
                                          item.controlStype == 'parameter' ||
                                          item.controlStype == 'unit'
                                        "
                                        value="like"
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? '在输入值中查找'
                                            : 'Look in the input value'
                                        "
                                      ></el-option>
                                    </el-select>

                                    <!-- 字段值操作开始 -->
                                    <el-input
                                      v-if="
                                        (item.controlStype == 'text' ||
                                          item.controlStype == 'textarea' ||
                                          item.controlStype == 'number') &&
                                        item.fieldIn !== ''
                                      "
                                      class="el-flow-line-field-text"
                                      style="width: 165px"
                                      v-model="item.fieldValue"
                                    ></el-input>
                                    <el-date-picker
                                      v-if="
                                        item.controlStype == 'month' &&
                                        item.fieldIn !== ''
                                      "
                                      v-model="item.fieldValue"
                                      type="month"
                                      style="width: 165px"
                                      :placeholder="
                                        $t('flowi18n.flow_line_property_datepicker_month')
                                      "
                                    ></el-date-picker>
                                    <el-date-picker
                                      v-if="
                                        item.controlStype == 'year' && item.fieldIn !== ''
                                      "
                                      v-model="item.fieldValue"
                                      type="year"
                                      style="width: 165px"
                                      :placeholder="
                                        $t('flowi18n.flow_line_property_datepicker_year')
                                      "
                                    ></el-date-picker>
                                    <el-date-picker
                                      v-if="
                                        (item.controlStype == 'date' ||
                                          item.controlStype == 'day') &&
                                        item.fieldIn !== ''
                                      "
                                      v-model="item.fieldValue"
                                      type="date"
                                      style="width: 165px"
                                      :placeholder="
                                        $t('flowi18n.flow_line_property_datepicker_date')
                                      "
                                    ></el-date-picker>
                                    <el-date-picker
                                      v-if="
                                        item.controlStype == 'datetime' &&
                                        item.fieldIn !== ''
                                      "
                                      v-model="item.fieldValue"
                                      type="datetime"
                                      style="width: 165px"
                                      :placeholder="
                                        $t(
                                          'flowi18n.flow_line_property_datepicker_datetime'
                                        )
                                      "
                                    ></el-date-picker>
                                    <el-time-picker
                                      v-if="
                                        item.controlStype == 'time' && item.fieldIn !== ''
                                      "
                                      v-model="item.fieldValue"
                                      style="width: 165px"
                                      :placeholder="
                                        $t('flowi18n.flow_line_property_datepicker_time')
                                      "
                                    ></el-time-picker>

                                    <!-- 系统控件 -->
                                    <el-select
                                      v-model="item.fieldValue"
                                      multiple
                                      @remove-tag="clearValue($event, item)"
                                      @clear="item.fieldValues = []"
                                      clearable="true"
                                      style="width: 180px"
                                      v-if="
                                        (item.controlStype == 'employee' ||
                                          item.controlStype == 'organizational' ||
                                          item.controlStype == 'position' ||
                                          item.controlStype == 'parameter' ||
                                          item.controlStype == 'unit') &&
                                        item.fieldIn !== ''
                                      "
                                      collapse-tags
                                      :placeholder="
                                        $t('formi18n.field_property_selectType_select')
                                      "
                                    >
                                      <el-option
                                        v-for="item in item.fieldValues"
                                        :key="item.value"
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? item.cnName
                                            : item.enName
                                        "
                                        :value="item.value"
                                        :disabled="1 == 1"
                                      ></el-option>
                                    </el-select>
                                    <el-button
                                      v-if="
                                        (item.controlStype == 'employee' ||
                                          item.controlStype == 'organizational' ||
                                          item.controlStype == 'position' ||
                                          item.controlStype == 'parameter' ||
                                          item.controlStype == 'unit') &&
                                        item.fieldIn !== ''
                                      "
                                      circle
                                      icon="el-icon-plus"
                                      plain
                                      type="primary"
                                      @click="dialogAddSystemControl(item, element)"
                                    ></el-button>
                                    <!-- 字段值操作结束 -->

                                    <el-input
                                      v-if="item.fieldIn == ''"
                                      class="el-flow-line-field-text"
                                      style="width: 165px"
                                      disabled
                                    ></el-input>
                                    <el-select
                                      class="el-flow-line-field-select"
                                      size="mini"
                                      :placeholder="
                                        $t('formi18n.field_property_selectType_select')
                                      "
                                      v-model="item.fieldRk"
                                      :disabled="item.fieldIn == ''"
                                    >
                                      <el-option
                                        value
                                        :label="
                                          $t('formi18n.field_property_selectType_select')
                                        "
                                      ></el-option>
                                      <el-option value=")" label=")"></el-option>
                                    </el-select>
                                    <el-select
                                      class="el-flow-line-field-select"
                                      size="mini"
                                      :placeholder="
                                        $t('formi18n.field_property_selectType_select')
                                      "
                                      v-model="item.fieldFor"
                                      :disabled="item.fieldKey == ''"
                                    >
                                      <el-option
                                        value
                                        :label="
                                          $t('formi18n.field_property_selectType_select')
                                        "
                                      ></el-option>
                                      <el-option
                                        value="AND"
                                        :label="
                                          $t(
                                            'formi18n.field_property_selectType_select_and'
                                          )
                                        "
                                      ></el-option>
                                      <el-option
                                        value="OR"
                                        :label="
                                          $t(
                                            'formi18n.field_property_selectType_select_or'
                                          )
                                        "
                                      ></el-option>
                                    </el-select>
                                    <el-button
                                      type="primary"
                                      icon="el-icon-plus"
                                      circle
                                      style="margin-right: 0px"
                                      @click="addConds(element.conditions)"
                                    ></el-button>
                                    <el-button
                                      type="danger"
                                      icon="el-icon-delete"
                                      circle
                                      style="margin-left: 2px"
                                      @click="removeConds(element.conditions, index)"
                                    ></el-button>
                                  </el-form-item>
                                </el-col>
                              </div>
                            </el-form>
                          </el-scrollbar>
                          <el-row>
                            <el-col>
                              <el-select
                                class="el-flow-line-field-select"
                                size="mini"
                                :placeholder="
                                  $t('formi18n.field_property_selectType_select')
                                "
                                v-model="element.areaRk"
                              >
                                <el-option
                                  value
                                  :label="$t('formi18n.field_property_selectType_select')"
                                ></el-option>
                                <el-option value=")" label=")"></el-option>
                              </el-select>
                              <el-select
                                class="el-flow-line-field-select"
                                size="mini"
                                :placeholder="
                                  $t('formi18n.field_property_selectType_select')
                                "
                                v-model="element.areaFor"
                              >
                                <el-option
                                  value
                                  :label="$t('formi18n.field_property_selectType_select')"
                                ></el-option>
                                <el-option
                                  value="AND"
                                  :label="
                                    $t('formi18n.field_property_selectType_select_and')
                                  "
                                ></el-option>
                                <el-option
                                  value="OR"
                                  :label="
                                    $t('formi18n.field_property_selectType_select_or')
                                  "
                                ></el-option>
                              </el-select>
                            </el-col>
                          </el-row>
                        </el-card>
                      </div>
                    </el-col>
                  </el-form>
                </el-scrollbar>
              </div>
            </el-main>
            <el-footer>
              <div class="form_handle-box">
                <el-button plain type="primary" @click="SaveEvent()" size="mini">{{
                  $t("table.Global_Save")
                }}</el-button>

                <el-button plain type="danger" @click="BackEvent()" size="mini">{{
                  $t("table.Global_Back")
                }}</el-button>
              </div>
            </el-footer>
          </el-container>
        </div>
      </el-tab-pane>
      <el-tab-pane name="emp">
        <template #label>
          <div>
            <span class="font_16px flow-el-tab-pane">
              <i class="el-icon-lx-profile"></i>
              {{ this.$t("flowi18n.flow_link_emp_property") }}
            </span>
          </div>
        </template>
        <div id="From_div_style" :style="autoHeight">
          <el-container class="custom-el-main">
            <el-main id="el-custom-form-main">
              <div class="container el-card-title" :style="contentHeight">
                <el-scrollbar>
                  <el-form label-width="100px" class="demo-ruleForm" size="mini">
                    <el-col style="width: 50%">
                      <el-form-item
                        size="small"
                        :label="$t('flowi18n.flow_line_property_CnName')"
                        class="el-from-custom-item"
                      >
                        <el-input v-model="linkproperty.meta.cnName"></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col style="width: 50%">
                      <el-form-item
                        size="small"
                        :label="$t('flowi18n.flow_line_property_EnName')"
                        class="el-from-custom-item"
                      >
                        <el-input v-model="linkproperty.meta.enName"></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col style="width: 100%">
                      <div
                        class="title"
                        v-for="element in employeeConditions"
                        :key="element.id"
                      >
                        <el-card class="box-card" style="min-height: 100px">
                          <template #header>
                            <div :class="'card-header'">
                              <span class="el-field-area-text">
                                <i class="el-icon-postcard"></i>
                                {{
                                  $i18n.locale === "zh-cn"
                                    ? element.areaCNName
                                    : element.areaENName
                                }}
                              </span>
                            </div>
                          </template>
                          <el-scrollbar :style="fieldContentHeight">
                            <el-form size="mini">
                              <div
                                v-for="(item, index) in element.conditions"
                                :key="index"
                              >
                                <el-col class="el-field-area-close" :style="'width:100%'">
                                  <el-form-item
                                    label-position="left"
                                    label-width="2px"
                                    class="el-feild-fields-item"
                                  >
                                    <el-select
                                      class="el-flow-line-field-select"
                                      size="mini"
                                      :placeholder="
                                        $t('formi18n.field_property_selectType_select')
                                      "
                                      v-model="item.fieldLk"
                                    >
                                      <el-option
                                        value
                                        :label="
                                          $t('formi18n.field_property_selectType_select')
                                        "
                                      ></el-option>
                                      <el-option value="(" label="("></el-option>
                                    </el-select>
                                    <el-select
                                      style="width: 140px"
                                      class="el-flow-line-field-select"
                                      size="mini"
                                      :placeholder="
                                        $t('formi18n.field_property_selectType_select')
                                      "
                                      v-model="item.personType"
                                    >
                                      <el-option
                                        value="0"
                                        :label="
                                          $t('formi18n.field_property_selectType_select')
                                        "
                                      ></el-option>
                                      <el-option
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? '申请人'
                                            : 'Applicant'
                                        "
                                        value="1"
                                      ></el-option>
                                      <el-option
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? '发起人'
                                            : 'Initiator'
                                        "
                                        value="2"
                                      ></el-option>
                                      <el-option
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? '当前任务处理人'
                                            : 'Current task handler'
                                        "
                                        value="3"
                                      ></el-option>
                                    </el-select>
                                    <el-select
                                      style="width: 140px"
                                      class="el-flow-line-field-select"
                                      size="mini"
                                      :placeholder="
                                        $t('formi18n.field_property_selectType_select')
                                      "
                                      v-model="item.fieldKey"
                                      @change="changeFields(item, element.fields)"
                                    >
                                      <el-option
                                        value
                                        :label="
                                          $t('formi18n.field_property_selectType_select')
                                        "
                                      ></el-option>
                                      <el-option
                                        v-for="field in element.fields"
                                        :key="field.fieldKey"
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? field.cnName
                                            : field.enName
                                        "
                                        :value="field.fieldKey"
                                      ></el-option>
                                    </el-select>
                                    <el-select
                                      class="el-flow-line-field-select"
                                      size="mini"
                                      :placeholder="
                                        $t('formi18n.field_property_selectType_select')
                                      "
                                      v-model="item.fieldIn"
                                      :disabled="item.fieldKey == ''"
                                      @change="changeFieldsIn(item)"
                                    >
                                      <el-option
                                        value
                                        :label="
                                          $t('formi18n.field_property_selectType_select')
                                        "
                                      ></el-option>
                                      <el-option
                                        value="="
                                        :label="
                                          this.$i18n.locale === 'zh-cn' ? '等于' : 'Equal'
                                        "
                                      ></el-option>
                                      <el-option
                                        value="!="
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? '不等于'
                                            : 'unEqual'
                                        "
                                      ></el-option>
                                      <el-option
                                        v-if="
                                          item.controlStype == 'number' ||
                                          item.controlStype == 'time' ||
                                          item.controlStype == 'day' ||
                                          item.controlStype == 'month' ||
                                          item.controlStype == 'year' ||
                                          item.controlStype == 'date' ||
                                          item.controlStype == 'datetime'
                                        "
                                        value=">"
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? '大于'
                                            : 'Greater than'
                                        "
                                      ></el-option>
                                      <el-option
                                        v-if="
                                          item.controlStype == 'number' ||
                                          item.controlStype == 'time' ||
                                          item.controlStype == 'day' ||
                                          item.controlStype == 'month' ||
                                          item.controlStype == 'year' ||
                                          item.controlStype == 'date' ||
                                          item.controlStype == 'datetime'
                                        "
                                        value="<"
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? '小于'
                                            : 'Less than'
                                        "
                                      ></el-option>
                                      <el-option
                                        v-if="
                                          item.controlStype == 'number' ||
                                          item.controlStype == 'time' ||
                                          item.controlStype == 'day' ||
                                          item.controlStype == 'month' ||
                                          item.controlStype == 'year' ||
                                          item.controlStype == 'date' ||
                                          item.controlStype == 'datetime'
                                        "
                                        value=">="
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? '大于等于'
                                            : 'Greater than or equal to'
                                        "
                                      ></el-option>
                                      <el-option
                                        v-if="
                                          item.controlStype == 'number' ||
                                          item.controlStype == 'time' ||
                                          item.controlStype == 'day' ||
                                          item.controlStype == 'month' ||
                                          item.controlStype == 'year' ||
                                          item.controlStype == 'date' ||
                                          item.controlStype == 'datetime'
                                        "
                                        value="<="
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? '小于等于'
                                            : 'Less than or equal to'
                                        "
                                      ></el-option>
                                      <el-option
                                        v-if="
                                          item.controlStype == 'text' ||
                                          item.controlStype == 'textarea' ||
                                          item.controlStype == 'employee' ||
                                          item.controlStype == 'organizational' ||
                                          item.controlStype == 'position' ||
                                          item.controlStype == 'parameter' ||
                                          item.controlStype == 'unit'
                                        "
                                        value="in"
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? '值在输入值中'
                                            : 'The value is in the input value'
                                        "
                                      ></el-option>
                                      <el-option
                                        v-if="
                                          item.controlStype == 'text' ||
                                          item.controlStype == 'textarea' ||
                                          item.controlStype == 'employee' ||
                                          item.controlStype == 'organizational' ||
                                          item.controlStype == 'position' ||
                                          item.controlStype == 'parameter' ||
                                          item.controlStype == 'unit'
                                        "
                                        value="like"
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? '在输入值中查找'
                                            : 'Look in the input value'
                                        "
                                      ></el-option>
                                    </el-select>

                                    <!-- 字段值操作开始 -->
                                    <el-input
                                      v-if="
                                        (item.controlStype == 'text' ||
                                          item.controlStype == 'textarea' ||
                                          item.controlStype == 'number') &&
                                        item.fieldIn !== ''
                                      "
                                      class="el-flow-line-field-text"
                                      style="width: 165px"
                                      v-model="item.fieldValue"
                                    ></el-input>
                                    <el-date-picker
                                      v-if="
                                        item.controlStype == 'month' &&
                                        item.fieldIn !== ''
                                      "
                                      v-model="item.fieldValue"
                                      type="month"
                                      style="width: 165px"
                                      :placeholder="
                                        $t('flowi18n.flow_line_property_datepicker_month')
                                      "
                                    ></el-date-picker>
                                    <el-date-picker
                                      v-if="
                                        item.controlStype == 'year' && item.fieldIn !== ''
                                      "
                                      v-model="item.fieldValue"
                                      type="year"
                                      style="width: 165px"
                                      :placeholder="
                                        $t('flowi18n.flow_line_property_datepicker_year')
                                      "
                                    ></el-date-picker>
                                    <el-date-picker
                                      v-if="
                                        (item.controlStype == 'date' ||
                                          item.controlStype == 'day') &&
                                        item.fieldIn !== ''
                                      "
                                      v-model="item.fieldValue"
                                      type="date"
                                      style="width: 165px"
                                      :placeholder="
                                        $t('flowi18n.flow_line_property_datepicker_date')
                                      "
                                    ></el-date-picker>
                                    <el-date-picker
                                      v-if="
                                        item.controlStype == 'datetime' &&
                                        item.fieldIn !== ''
                                      "
                                      v-model="item.fieldValue"
                                      type="datetime"
                                      style="width: 165px"
                                      :placeholder="
                                        $t(
                                          'flowi18n.flow_line_property_datepicker_datetime'
                                        )
                                      "
                                    ></el-date-picker>
                                    <el-time-picker
                                      v-if="
                                        item.controlStype == 'time' && item.fieldIn !== ''
                                      "
                                      v-model="item.fieldValue"
                                      style="width: 165px"
                                      :placeholder="
                                        $t('flowi18n.flow_line_property_datepicker_time')
                                      "
                                    ></el-time-picker>

                                    <!-- 系统控件 -->
                                    <el-select
                                      v-model="item.fieldValue"
                                      @remove-tag="clearValue($event, item)"
                                      @clear="item.fieldValues = []"
                                      multiple
                                      clearable="true"
                                      style="width: 180px"
                                      v-if="
                                        (item.controlStype == 'employee' ||
                                          item.controlStype == 'organizational' ||
                                          item.controlStype == 'position' ||
                                          item.controlStype == 'parameter' ||
                                          item.controlStype == 'unit') &&
                                        item.fieldIn !== ''
                                      "
                                      collapse-tags
                                      :placeholder="
                                        $t('formi18n.field_property_selectType_select')
                                      "
                                    >
                                      <el-option
                                        v-for="item in item.fieldValues"
                                        :key="item.value"
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? item.cnName
                                            : item.enName
                                        "
                                        :value="item.value"
                                        :disabled="1 == 1"
                                      ></el-option>
                                    </el-select>
                                    <el-button
                                      v-if="
                                        (item.controlStype == 'employee' ||
                                          item.controlStype == 'organizational' ||
                                          item.controlStype == 'position' ||
                                          item.controlStype == 'parameter' ||
                                          item.controlStype == 'unit') &&
                                        item.fieldIn !== ''
                                      "
                                      circle
                                      icon="el-icon-plus"
                                      plain
                                      type="primary"
                                      @click="dialogAddSystemControl(item, element)"
                                    ></el-button>
                                    <!-- 字段值操作结束 -->

                                    <el-input
                                      v-if="item.fieldIn == ''"
                                      class="el-flow-line-field-text"
                                      style="width: 165px"
                                      disabled
                                    ></el-input>
                                    <el-select
                                      class="el-flow-line-field-select"
                                      size="mini"
                                      :placeholder="
                                        $t('formi18n.field_property_selectType_select')
                                      "
                                      v-model="item.fieldRk"
                                      :disabled="item.fieldIn == ''"
                                    >
                                      <el-option
                                        value
                                        :label="
                                          $t('formi18n.field_property_selectType_select')
                                        "
                                      ></el-option>
                                      <el-option value=")" label=")"></el-option>
                                    </el-select>
                                    <el-select
                                      class="el-flow-line-field-select"
                                      size="mini"
                                      :placeholder="
                                        $t('formi18n.field_property_selectType_select')
                                      "
                                      v-model="item.fieldFor"
                                      :disabled="item.fieldKey == ''"
                                    >
                                      <el-option
                                        value
                                        :label="
                                          $t('formi18n.field_property_selectType_select')
                                        "
                                      ></el-option>
                                      <el-option
                                        value="AND"
                                        :label="
                                          $t(
                                            'formi18n.field_property_selectType_select_and'
                                          )
                                        "
                                      ></el-option>
                                      <el-option
                                        value="OR"
                                        :label="
                                          $t(
                                            'formi18n.field_property_selectType_select_or'
                                          )
                                        "
                                      ></el-option>
                                    </el-select>
                                    <el-button
                                      type="primary"
                                      icon="el-icon-plus"
                                      circle
                                      style="margin-right: 0px"
                                      @click="addConds(element.conditions)"
                                    ></el-button>
                                    <el-button
                                      type="danger"
                                      icon="el-icon-delete"
                                      circle
                                      style="margin-left: 2px"
                                      @click="removeConds(element.conditions, index)"
                                    ></el-button>
                                  </el-form-item>
                                </el-col>
                              </div>
                            </el-form>
                          </el-scrollbar>
                        </el-card>
                      </div>
                    </el-col>
                  </el-form>
                </el-scrollbar>
              </div>
            </el-main>
            <el-footer>
              <div class="form_handle-box">
                <el-button plain type="primary" @click="SaveEvent()" size="mini">{{
                  $t("table.Global_Save")
                }}</el-button>

                <el-button plain type="danger" @click="BackEvent()" size="mini">{{
                  $t("table.Global_Back")
                }}</el-button>
              </div>
            </el-footer>
          </el-container>
        </div>
      </el-tab-pane>
      <el-tab-pane name="org">
        <template #label>
          <div>
            <span class="font_16px flow-el-tab-pane">
              <i class="el-icon-office-building"></i>
              {{ this.$t("flowi18n.flow_link_org_property") }}
            </span>
          </div>
        </template>
        <div id="From_div_style" :style="autoHeight">
          <el-container class="custom-el-main">
            <el-main id="el-custom-form-main">
              <div class="container el-card-title" :style="contentHeight">
                <el-scrollbar>
                  <el-form label-width="100px" class="demo-ruleForm" size="mini">
                    <el-col style="width: 50%">
                      <el-form-item
                        size="small"
                        :label="$t('flowi18n.flow_line_property_CnName')"
                        class="el-from-custom-item"
                      >
                        <el-input v-model="linkproperty.meta.cnName"></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col style="width: 50%">
                      <el-form-item
                        size="small"
                        :label="$t('flowi18n.flow_line_property_EnName')"
                        class="el-from-custom-item"
                      >
                        <el-input v-model="linkproperty.meta.enName"></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col style="width: 100%">
                      <div
                        class="title"
                        v-for="element in departmentConditions"
                        :key="element.id"
                      >
                        <el-card class="box-card" style="min-height: 100px">
                          <template #header>
                            <div :class="'card-header'">
                              <span class="el-field-area-text">
                                <i class="el-icon-postcard"></i>
                                {{
                                  $i18n.locale === "zh-cn"
                                    ? element.areaCNName
                                    : element.areaENName
                                }}
                              </span>
                            </div>
                          </template>
                          <el-scrollbar :style="fieldContentHeight">
                            <el-form size="mini">
                              <div
                                v-for="(item, index) in element.conditions"
                                :key="index"
                              >
                                <el-col class="el-field-area-close" :style="'width:100%'">
                                  <el-form-item
                                    label-position="left"
                                    label-width="2px"
                                    class="el-feild-fields-item"
                                  >
                                    <el-select
                                      class="el-flow-line-field-select"
                                      size="mini"
                                      :placeholder="
                                        $t('formi18n.field_property_selectType_select')
                                      "
                                      v-model="item.fieldLk"
                                    >
                                      <el-option
                                        value
                                        :label="
                                          $t('formi18n.field_property_selectType_select')
                                        "
                                      ></el-option>
                                      <el-option value="(" label="("></el-option>
                                    </el-select>
                                    <el-select
                                      style="width: 140px"
                                      class="el-flow-line-field-select"
                                      size="mini"
                                      :placeholder="
                                        $t('formi18n.field_property_selectType_select')
                                      "
                                      v-model="item.personType"
                                    >
                                      <el-option
                                        value="0"
                                        :label="
                                          $t('formi18n.field_property_selectType_select')
                                        "
                                      ></el-option>
                                      <el-option
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? '申请人'
                                            : 'Applicant'
                                        "
                                        value="1"
                                      ></el-option>
                                      <el-option
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? '发起人'
                                            : 'Initiator'
                                        "
                                        value="2"
                                      ></el-option>
                                      <el-option
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? '当前任务处理人'
                                            : 'Current task handler'
                                        "
                                        value="3"
                                      ></el-option>
                                    </el-select>

                                    <el-select
                                      style="width: 140px"
                                      class="el-flow-line-field-select"
                                      size="mini"
                                      :placeholder="
                                        $t('formi18n.field_property_selectType_select')
                                      "
                                      v-model="item.fieldKey"
                                      @change="changeFields(item, element.fields)"
                                    >
                                      <el-option
                                        value
                                        :label="
                                          $t('formi18n.field_property_selectType_select')
                                        "
                                      ></el-option>
                                      <el-option
                                        v-for="field in element.fields"
                                        :key="field.fieldKey"
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? field.cnName
                                            : field.enName
                                        "
                                        :value="field.fieldKey"
                                      ></el-option>
                                    </el-select>
                                    <el-select
                                      class="el-flow-line-field-select"
                                      size="mini"
                                      :placeholder="
                                        $t('formi18n.field_property_selectType_select')
                                      "
                                      v-model="item.fieldIn"
                                      :disabled="item.fieldKey == ''"
                                      @change="changeFieldsIn(item)"
                                    >
                                      <el-option
                                        value
                                        :label="
                                          $t('formi18n.field_property_selectType_select')
                                        "
                                      ></el-option>
                                      <el-option
                                        value="="
                                        :label="
                                          this.$i18n.locale === 'zh-cn' ? '等于' : 'Equal'
                                        "
                                      ></el-option>
                                      <el-option
                                        value="!="
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? '不等于'
                                            : 'unEqual'
                                        "
                                      ></el-option>
                                      <el-option
                                        v-if="
                                          item.controlStype == 'number' ||
                                          item.controlStype == 'time' ||
                                          item.controlStype == 'day' ||
                                          item.controlStype == 'month' ||
                                          item.controlStype == 'year' ||
                                          item.controlStype == 'date' ||
                                          item.controlStype == 'datetime'
                                        "
                                        value=">"
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? '大于'
                                            : 'Greater than'
                                        "
                                      ></el-option>
                                      <el-option
                                        v-if="
                                          item.controlStype == 'number' ||
                                          item.controlStype == 'time' ||
                                          item.controlStype == 'day' ||
                                          item.controlStype == 'month' ||
                                          item.controlStype == 'year' ||
                                          item.controlStype == 'date' ||
                                          item.controlStype == 'datetime'
                                        "
                                        value="<"
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? '小于'
                                            : 'Less than'
                                        "
                                      ></el-option>
                                      <el-option
                                        v-if="
                                          item.controlStype == 'number' ||
                                          item.controlStype == 'time' ||
                                          item.controlStype == 'day' ||
                                          item.controlStype == 'month' ||
                                          item.controlStype == 'year' ||
                                          item.controlStype == 'date' ||
                                          item.controlStype == 'datetime'
                                        "
                                        value=">="
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? '大于等于'
                                            : 'Greater than or equal to'
                                        "
                                      ></el-option>
                                      <el-option
                                        v-if="
                                          item.controlStype == 'number' ||
                                          item.controlStype == 'time' ||
                                          item.controlStype == 'day' ||
                                          item.controlStype == 'month' ||
                                          item.controlStype == 'year' ||
                                          item.controlStype == 'date' ||
                                          item.controlStype == 'datetime'
                                        "
                                        value="<="
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? '小于等于'
                                            : 'Less than or equal to'
                                        "
                                      ></el-option>
                                      <el-option
                                        v-if="
                                          item.controlStype == 'text' ||
                                          item.controlStype == 'textarea' ||
                                          item.controlStype == 'employee' ||
                                          item.controlStype == 'organizational' ||
                                          item.controlStype == 'position' ||
                                          item.controlStype == 'parameter' ||
                                          item.controlStype == 'unit'
                                        "
                                        value="in"
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? '值在输入值中'
                                            : 'The value is in the input value'
                                        "
                                      ></el-option>
                                      <el-option
                                        v-if="
                                          item.controlStype == 'text' ||
                                          item.controlStype == 'textarea' ||
                                          item.controlStype == 'employee' ||
                                          item.controlStype == 'organizational' ||
                                          item.controlStype == 'position' ||
                                          item.controlStype == 'parameter' ||
                                          item.controlStype == 'unit'
                                        "
                                        value="like"
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? '在输入值中查找'
                                            : 'Look in the input value'
                                        "
                                      ></el-option>
                                    </el-select>

                                    <!-- 字段值操作开始 -->
                                    <el-input
                                      v-if="
                                        (item.controlStype == 'text' ||
                                          item.controlStype == 'textarea' ||
                                          item.controlStype == 'number') &&
                                        item.fieldIn !== ''
                                      "
                                      class="el-flow-line-field-text"
                                      style="width: 165px"
                                      v-model="item.fieldValue"
                                    ></el-input>
                                    <el-date-picker
                                      v-if="
                                        item.controlStype == 'month' &&
                                        item.fieldIn !== ''
                                      "
                                      v-model="item.fieldValue"
                                      type="month"
                                      style="width: 165px"
                                      :placeholder="
                                        $t('flowi18n.flow_line_property_datepicker_month')
                                      "
                                    ></el-date-picker>
                                    <el-date-picker
                                      v-if="
                                        item.controlStype == 'year' && item.fieldIn !== ''
                                      "
                                      v-model="item.fieldValue"
                                      type="year"
                                      style="width: 165px"
                                      :placeholder="
                                        $t('flowi18n.flow_line_property_datepicker_year')
                                      "
                                    ></el-date-picker>
                                    <el-date-picker
                                      v-if="
                                        (item.controlStype == 'date' ||
                                          item.controlStype == 'day') &&
                                        item.fieldIn !== ''
                                      "
                                      v-model="item.fieldValue"
                                      type="date"
                                      style="width: 165px"
                                      :placeholder="
                                        $t('flowi18n.flow_line_property_datepicker_date')
                                      "
                                    ></el-date-picker>
                                    <el-date-picker
                                      v-if="
                                        item.controlStype == 'datetime' &&
                                        item.fieldIn !== ''
                                      "
                                      v-model="item.fieldValue"
                                      type="datetime"
                                      style="width: 165px"
                                      :placeholder="
                                        $t(
                                          'flowi18n.flow_line_property_datepicker_datetime'
                                        )
                                      "
                                    ></el-date-picker>
                                    <el-time-picker
                                      v-if="
                                        item.controlStype == 'time' && item.fieldIn !== ''
                                      "
                                      v-model="item.fieldValue"
                                      style="width: 165px"
                                      :placeholder="
                                        $t('flowi18n.flow_line_property_datepicker_time')
                                      "
                                    ></el-time-picker>

                                    <!-- 系统控件 -->
                                    <el-select
                                      v-model="item.fieldValue"
                                      multiple
                                      clearable="true"
                                      @remove-tag="clearValue($event, item)"
                                      @clear="item.fieldValues = []"
                                      style="width: 180px"
                                      v-if="
                                        (item.controlStype == 'employee' ||
                                          item.controlStype == 'organizational' ||
                                          item.controlStype == 'position' ||
                                          item.controlStype == 'parameter' ||
                                          item.controlStype == 'unit') &&
                                        item.fieldIn !== ''
                                      "
                                      collapse-tags
                                      :placeholder="
                                        $t('formi18n.field_property_selectType_select')
                                      "
                                    >
                                      <el-option
                                        v-for="item in item.fieldValues"
                                        :key="item.value"
                                        :label="
                                          this.$i18n.locale === 'zh-cn'
                                            ? item.cnName
                                            : item.enName
                                        "
                                        :value="item.value"
                                        :disabled="1 == 1"
                                      ></el-option>
                                    </el-select>
                                    <el-button
                                      v-if="
                                        (item.controlStype == 'employee' ||
                                          item.controlStype == 'organizational' ||
                                          item.controlStype == 'position' ||
                                          item.controlStype == 'parameter' ||
                                          item.controlStype == 'unit') &&
                                        item.fieldIn !== ''
                                      "
                                      circle
                                      icon="el-icon-plus"
                                      plain
                                      type="primary"
                                      @click="dialogAddSystemControl(item, element)"
                                    ></el-button>
                                    <!-- 字段值操作结束 -->

                                    <el-input
                                      v-if="item.fieldIn == ''"
                                      class="el-flow-line-field-text"
                                      style="width: 165px"
                                      disabled
                                    ></el-input>
                                    <el-select
                                      class="el-flow-line-field-select"
                                      size="mini"
                                      :placeholder="
                                        $t('formi18n.field_property_selectType_select')
                                      "
                                      v-model="item.fieldRk"
                                      :disabled="item.fieldIn == ''"
                                    >
                                      <el-option
                                        value
                                        :label="
                                          $t('formi18n.field_property_selectType_select')
                                        "
                                      ></el-option>
                                      <el-option value=")" label=")"></el-option>
                                    </el-select>
                                    <el-select
                                      class="el-flow-line-field-select"
                                      size="mini"
                                      :placeholder="
                                        $t('formi18n.field_property_selectType_select')
                                      "
                                      v-model="item.fieldFor"
                                      :disabled="item.fieldKey == ''"
                                    >
                                      <el-option
                                        value
                                        :label="
                                          $t('formi18n.field_property_selectType_select')
                                        "
                                      ></el-option>
                                      <el-option
                                        value="AND"
                                        :label="
                                          $t(
                                            'formi18n.field_property_selectType_select_and'
                                          )
                                        "
                                      ></el-option>
                                      <el-option
                                        value="OR"
                                        :label="
                                          $t(
                                            'formi18n.field_property_selectType_select_or'
                                          )
                                        "
                                      ></el-option>
                                    </el-select>
                                    <el-button
                                      type="primary"
                                      icon="el-icon-plus"
                                      circle
                                      style="margin-right: 0px"
                                      @click="addConds(element.conditions)"
                                    ></el-button>
                                    <el-button
                                      type="danger"
                                      icon="el-icon-delete"
                                      circle
                                      style="margin-left: 2px"
                                      @click="removeConds(element.conditions, index)"
                                    ></el-button>
                                  </el-form-item>
                                </el-col>
                              </div>
                            </el-form>
                          </el-scrollbar>
                        </el-card>
                      </div>
                    </el-col>
                  </el-form>
                </el-scrollbar>
              </div>
            </el-main>
            <el-footer>
              <div class="form_handle-box">
                <el-button plain type="primary" @click="SaveEvent()" size="mini">{{
                  $t("table.Global_Save")
                }}</el-button>

                <el-button plain type="danger" @click="BackEvent()" size="mini">{{
                  $t("table.Global_Back")
                }}</el-button>
              </div>
            </el-footer>
          </el-container>
        </div>
      </el-tab-pane>
      <el-tab-pane name="pos">
        <template #label>
          <div>
            <span class="font_16px flow-el-tab-pane">
              <i class="el-icon-lx-group"></i>
              {{ this.$t("flowi18n.flow_link_position_property") }}
            </span>
          </div>
        </template>
        <div id="From_div_style" :style="autoHeight">
          <el-container class="custom-el-main">
            <el-main id="el-custom-form-main">
              <div class="container el-card-title" :style="contentHeight">
                <el-form label-width="100px" class="demo-ruleForm" size="mini">
                  <el-col style="width: 50%">
                    <el-form-item
                      size="small"
                      :label="$t('flowi18n.flow_line_property_CnName')"
                      class="el-from-custom-item"
                    >
                      <el-input v-model="linkproperty.meta.cnName"></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col style="width: 50%">
                    <el-form-item
                      size="small"
                      :label="$t('flowi18n.flow_line_property_EnName')"
                      class="el-from-custom-item"
                    >
                      <el-input v-model="linkproperty.meta.enName"></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col style="width: 100%">
                    <div
                      class="title"
                      v-for="element in positionsConditions"
                      :key="element.id"
                    >
                      <el-card class="box-card" style="min-height: 100px">
                        <template #header>
                          <div :class="'card-header'">
                            <span class="el-field-area-text">
                              <i class="el-icon-postcard"></i>
                              {{
                                $i18n.locale === "zh-cn"
                                  ? element.areaCNName
                                  : element.areaENName
                              }}
                            </span>
                          </div>
                        </template>
                        <el-scrollbar :style="fieldContentHeight">
                          <el-form size="mini">
                            <div v-for="(item, index) in element.conditions" :key="index">
                              <el-col class="el-field-area-close" :style="'width:100%'">
                                <el-form-item
                                  label-position="left"
                                  label-width="2px"
                                  class="el-feild-fields-item"
                                >
                                  <el-select
                                    class="el-flow-line-field-select"
                                    size="mini"
                                    :placeholder="
                                      $t('formi18n.field_property_selectType_select')
                                    "
                                    v-model="item.fieldLk"
                                  >
                                    <el-option
                                      value
                                      :label="
                                        $t('formi18n.field_property_selectType_select')
                                      "
                                    ></el-option>
                                    <el-option value="(" label="("></el-option>
                                  </el-select>
                                  <el-select
                                    style="width: 140px"
                                    class="el-flow-line-field-select"
                                    size="mini"
                                    :placeholder="
                                      $t('formi18n.field_property_selectType_select')
                                    "
                                    v-model="item.personType"
                                  >
                                    <el-option
                                      value="0"
                                      :label="
                                        $t('formi18n.field_property_selectType_select')
                                      "
                                    ></el-option>
                                    <el-option
                                      :label="
                                        this.$i18n.locale === 'zh-cn'
                                          ? '申请人'
                                          : 'Applicant'
                                      "
                                      value="1"
                                    ></el-option>
                                    <el-option
                                      :label="
                                        this.$i18n.locale === 'zh-cn'
                                          ? '发起人'
                                          : 'Initiator'
                                      "
                                      value="2"
                                    ></el-option>
                                    <el-option
                                      :label="
                                        this.$i18n.locale === 'zh-cn'
                                          ? '当前任务处理人'
                                          : 'Current task handler'
                                      "
                                      value="3"
                                    ></el-option>
                                  </el-select>
                                  <el-select
                                    style="width: 140px"
                                    class="el-flow-line-field-select"
                                    size="mini"
                                    :placeholder="
                                      $t('formi18n.field_property_selectType_select')
                                    "
                                    v-model="item.fieldKey"
                                    @change="changeFields(item, element.fields)"
                                  >
                                    <el-option
                                      value
                                      :label="
                                        $t('formi18n.field_property_selectType_select')
                                      "
                                    ></el-option>
                                    <el-option
                                      v-for="field in element.fields"
                                      :key="field.fieldKey"
                                      :label="
                                        this.$i18n.locale === 'zh-cn'
                                          ? field.cnName
                                          : field.enName
                                      "
                                      :value="field.fieldKey"
                                    ></el-option>
                                  </el-select>
                                  <el-select
                                    class="el-flow-line-field-select"
                                    size="mini"
                                    :placeholder="
                                      $t('formi18n.field_property_selectType_select')
                                    "
                                    v-model="item.fieldIn"
                                    :disabled="item.fieldKey == ''"
                                    @change="changeFieldsIn(item)"
                                  >
                                    <el-option
                                      value
                                      :label="
                                        $t('formi18n.field_property_selectType_select')
                                      "
                                    ></el-option>
                                    <el-option
                                      value="="
                                      :label="
                                        this.$i18n.locale === 'zh-cn' ? '等于' : 'Equal'
                                      "
                                    ></el-option>
                                    <el-option
                                      value="!="
                                      :label="
                                        this.$i18n.locale === 'zh-cn'
                                          ? '不等于'
                                          : 'unEqual'
                                      "
                                    ></el-option>
                                    <el-option
                                      v-if="
                                        item.controlStype == 'number' ||
                                        item.controlStype == 'time' ||
                                        item.controlStype == 'day' ||
                                        item.controlStype == 'month' ||
                                        item.controlStype == 'year' ||
                                        item.controlStype == 'date' ||
                                        item.controlStype == 'datetime'
                                      "
                                      value=">"
                                      :label="
                                        this.$i18n.locale === 'zh-cn'
                                          ? '大于'
                                          : 'Greater than'
                                      "
                                    ></el-option>
                                    <el-option
                                      v-if="
                                        item.controlStype == 'number' ||
                                        item.controlStype == 'time' ||
                                        item.controlStype == 'day' ||
                                        item.controlStype == 'month' ||
                                        item.controlStype == 'year' ||
                                        item.controlStype == 'date' ||
                                        item.controlStype == 'datetime'
                                      "
                                      value="<"
                                      :label="
                                        this.$i18n.locale === 'zh-cn'
                                          ? '小于'
                                          : 'Less than'
                                      "
                                    ></el-option>
                                    <el-option
                                      v-if="
                                        item.controlStype == 'number' ||
                                        item.controlStype == 'time' ||
                                        item.controlStype == 'day' ||
                                        item.controlStype == 'month' ||
                                        item.controlStype == 'year' ||
                                        item.controlStype == 'date' ||
                                        item.controlStype == 'datetime'
                                      "
                                      value=">="
                                      :label="
                                        this.$i18n.locale === 'zh-cn'
                                          ? '大于等于'
                                          : 'Greater than or equal to'
                                      "
                                    ></el-option>
                                    <el-option
                                      v-if="
                                        item.controlStype == 'number' ||
                                        item.controlStype == 'time' ||
                                        item.controlStype == 'day' ||
                                        item.controlStype == 'month' ||
                                        item.controlStype == 'year' ||
                                        item.controlStype == 'date' ||
                                        item.controlStype == 'datetime'
                                      "
                                      value="<="
                                      :label="
                                        this.$i18n.locale === 'zh-cn'
                                          ? '小于等于'
                                          : 'Less than or equal to'
                                      "
                                    ></el-option>
                                    <el-option
                                      v-if="
                                        item.controlStype == 'text' ||
                                        item.controlStype == 'textarea' ||
                                        item.controlStype == 'employee' ||
                                        item.controlStype == 'organizational' ||
                                        item.controlStype == 'position' ||
                                        item.controlStype == 'parameter' ||
                                        item.controlStype == 'unit'
                                      "
                                      value="in"
                                      :label="
                                        this.$i18n.locale === 'zh-cn'
                                          ? '值在输入值中'
                                          : 'The value is in the input value'
                                      "
                                    ></el-option>
                                    <el-option
                                      v-if="
                                        item.controlStype == 'text' ||
                                        item.controlStype == 'textarea' ||
                                        item.controlStype == 'employee' ||
                                        item.controlStype == 'organizational' ||
                                        item.controlStype == 'position' ||
                                        item.controlStype == 'parameter' ||
                                        item.controlStype == 'unit'
                                      "
                                      value="like"
                                      :label="
                                        this.$i18n.locale === 'zh-cn'
                                          ? '在输入值中查找'
                                          : 'Look in the input value'
                                      "
                                    ></el-option>
                                  </el-select>

                                  <!-- 字段值操作开始 -->
                                  <el-input
                                    v-if="
                                      (item.controlStype == 'text' ||
                                        item.controlStype == 'textarea' ||
                                        item.controlStype == 'number') &&
                                      item.fieldIn !== ''
                                    "
                                    class="el-flow-line-field-text"
                                    style="width: 165px"
                                    v-model="item.fieldValue"
                                  ></el-input>
                                  <el-date-picker
                                    v-if="
                                      item.controlStype == 'month' && item.fieldIn !== ''
                                    "
                                    v-model="item.fieldValue"
                                    type="month"
                                    style="width: 165px"
                                    :placeholder="
                                      $t('flowi18n.flow_line_property_datepicker_month')
                                    "
                                  ></el-date-picker>
                                  <el-date-picker
                                    v-if="
                                      item.controlStype == 'year' && item.fieldIn !== ''
                                    "
                                    v-model="item.fieldValue"
                                    type="year"
                                    style="width: 165px"
                                    :placeholder="
                                      $t('flowi18n.flow_line_property_datepicker_year')
                                    "
                                  ></el-date-picker>
                                  <el-date-picker
                                    v-if="
                                      (item.controlStype == 'date' ||
                                        item.controlStype == 'day') &&
                                      item.fieldIn !== ''
                                    "
                                    v-model="item.fieldValue"
                                    type="date"
                                    style="width: 165px"
                                    :placeholder="
                                      $t('flowi18n.flow_line_property_datepicker_date')
                                    "
                                  ></el-date-picker>
                                  <el-date-picker
                                    v-if="
                                      item.controlStype == 'datetime' &&
                                      item.fieldIn !== ''
                                    "
                                    v-model="item.fieldValue"
                                    type="datetime"
                                    style="width: 165px"
                                    :placeholder="
                                      $t(
                                        'flowi18n.flow_line_property_datepicker_datetime'
                                      )
                                    "
                                  ></el-date-picker>
                                  <el-time-picker
                                    v-if="
                                      item.controlStype == 'time' && item.fieldIn !== ''
                                    "
                                    v-model="item.fieldValue"
                                    style="width: 165px"
                                    :placeholder="
                                      $t('flowi18n.flow_line_property_datepicker_time')
                                    "
                                  ></el-time-picker>

                                  <!-- 系统控件 -->
                                  <el-select
                                    @remove-tag="clearValue($event, item)"
                                    clearable="true"
                                    @clear="item.fieldValues = []"
                                    v-model="item.fieldValue"
                                    multiple
                                    style="width: 180px"
                                    v-if="
                                      (item.controlStype == 'employee' ||
                                        item.controlStype == 'organizational' ||
                                        item.controlStype == 'position' ||
                                        item.controlStype == 'parameter' ||
                                        item.controlStype == 'unit') &&
                                      item.fieldIn !== ''
                                    "
                                    collapse-tags
                                    :placeholder="
                                      $t('formi18n.field_property_selectType_select')
                                    "
                                  >
                                    <el-option
                                      v-for="item in item.fieldValues"
                                      :key="item.value"
                                      :label="
                                        this.$i18n.locale === 'zh-cn'
                                          ? item.cnName
                                          : item.enName
                                      "
                                      :value="item.value"
                                      :disabled="1 == 1"
                                    ></el-option>
                                  </el-select>
                                  <el-button
                                    v-if="
                                      (item.controlStype == 'employee' ||
                                        item.controlStype == 'organizational' ||
                                        item.controlStype == 'position' ||
                                        item.controlStype == 'parameter' ||
                                        item.controlStype == 'unit') &&
                                      item.fieldIn !== ''
                                    "
                                    circle
                                    icon="el-icon-plus"
                                    plain
                                    type="primary"
                                    @click="dialogAddSystemControl(item, element)"
                                  ></el-button>
                                  <!-- 字段值操作结束 -->

                                  <el-input
                                    v-if="item.fieldIn == ''"
                                    class="el-flow-line-field-text"
                                    style="width: 165px"
                                    disabled
                                  ></el-input>
                                  <el-select
                                    class="el-flow-line-field-select"
                                    size="mini"
                                    :placeholder="
                                      $t('formi18n.field_property_selectType_select')
                                    "
                                    v-model="item.fieldRk"
                                    :disabled="item.fieldIn == ''"
                                  >
                                    <el-option
                                      value
                                      :label="
                                        $t('formi18n.field_property_selectType_select')
                                      "
                                    ></el-option>
                                    <el-option value=")" label=")"></el-option>
                                  </el-select>
                                  <el-select
                                    class="el-flow-line-field-select"
                                    size="mini"
                                    :placeholder="
                                      $t('formi18n.field_property_selectType_select')
                                    "
                                    v-model="item.fieldFor"
                                    :disabled="item.fieldKey == ''"
                                  >
                                    <el-option
                                      value
                                      :label="
                                        $t('formi18n.field_property_selectType_select')
                                      "
                                    ></el-option>
                                    <el-option
                                      value="AND"
                                      :label="
                                        $t(
                                          'formi18n.field_property_selectType_select_and'
                                        )
                                      "
                                    ></el-option>
                                    <el-option
                                      value="OR"
                                      :label="
                                        $t('formi18n.field_property_selectType_select_or')
                                      "
                                    ></el-option>
                                  </el-select>
                                  <el-button
                                    type="primary"
                                    icon="el-icon-plus"
                                    circle
                                    style="margin-right: 0px"
                                    @click="addConds(element.conditions)"
                                  ></el-button>
                                  <el-button
                                    type="danger"
                                    icon="el-icon-delete"
                                    circle
                                    style="margin-left: 2px"
                                    @click="removeConds(element.conditions, index)"
                                  ></el-button>
                                </el-form-item>
                              </el-col>
                            </div>
                          </el-form>
                        </el-scrollbar>
                      </el-card>
                    </div>
                  </el-col>
                </el-form>
              </div>
            </el-main>
            <el-footer>
              <div class="form_handle-box">
                <el-button plain type="primary" @click="SaveEvent()" size="mini">{{
                  $t("table.Global_Save")
                }}</el-button>

                <el-button plain type="danger" @click="BackEvent()" size="mini">{{
                  $t("table.Global_Back")
                }}</el-button>
              </div>
            </el-footer>
          </el-container>
        </div>
      </el-tab-pane>
    </el-tabs>
    <div class="el-dialog-content">
      <dialog-employee-componet-vue
        ref="emp"
        @confirmEvent="dialogEmpConfirmEvent"
      ></dialog-employee-componet-vue>
      <dialog-position-componet-vue
        ref="pos"
        @confirmEvent="dialogPostConfirmEvent"
      ></dialog-position-componet-vue>
      <dialog-org-componet-vue
        ref="org"
        @confirmEvent="dialogOrgConfirmEvent"
        :expandAll="1 == 1"
      ></dialog-org-componet-vue>
      <dialog-parameter-componet-vue
        ref="parameter"
        @confirmEvent="dialogParameterConfirmEvent"
        :expandAll="1 == 1"
      ></dialog-parameter-componet-vue>
      <dialog-unit-componet-vue
        ref="unit"
        @confirmEvent="dialogUnitConfirmEvent"
        :expandAll="1 == 1"
      ></dialog-unit-componet-vue>
    </div>
  </div>
</template>

<script>
import flowConfig from "../assets/config/model.json";
import reqVue from "../utils/req.vue";
import confVue from "../utils/conf.vue";
import DialogEmployeeComponetVue from "./DialogEmployeeComponet.vue";
import DialogPositionComponetVue from "./DialogPositionComponet.vue";
import DialogOrgComponetVue from "./DialogOrgComponet.vue";
import DialogParameterComponetVue from "./DialogParameterComponet.vue";
import DialogUnitComponetVue from "./DialogUnitComponet.vue";

let windowHeight = parseInt(window.innerHeight);
export default {
  props: {
    oldproperty: {
      type: Object,
      default: () => ({}),
    },
    bindproperty: {
      type: Object,
      default: () => ({}),
    },
    lineproperty: {
      type: Object,
      default: () => ({}),
    },
    formversionid: {
      type: Number,
      default: () => 0,
    },
    flowversionid: {
      type: Number,
      default: () => 0,
    },
  },
  name: "flow-line-property",
  data() {
    return {
      formLoading: false,
      newNode: this.lineproperty,
      linkproperty: this.bindproperty,
      oldnode: this.oldproperty,
      apipath: "flowinfo",
      way: confVue.$flowApi,
      formInfo: {},
      autoHeight: {
        height: "",
        width: "97%",
        margin: "11px",
        float: "left",
      },
      contentHeight: {
        height: "",
      },
      fieldContentHeight: { height: "240px" },
      activeName: "business",
      conf: flowConfig.conf,
      businessConditions: [],
      employeeConditions: [],
      departmentConditions: [],
      positionsConditions: [],
    };
  },

  methods: {
    ///设置窗台的高度
    getHeight() {
      this.autoHeight.height = windowHeight - 60 + "px";
      this.contentHeight.height = windowHeight - 200 + "px";
      this.fieldContentHeight.height = windowHeight - 370 + "px";
      this.initBusineseFields();
    },
    SaveEvent() {
      this.saveData(this.linkproperty);
      this.$emit("FlowLinePropetryEvent");
    },
    BackEvent() {
      this.saveData(this.oldproperty);
      this.$emit("FlowLinePropetryEvent");
    }, ///初始化节点属性
    saveData(property) {
      this.newNode.meta = this.newNode.meta == null ? {} : this.newNode.meta;
      this.newNode.meta.cnName = property.meta.cnName;
      this.newNode.meta.enName = property.meta.enName;
      this.newNode.meta.branchTag = property.meta.branchTag;
      this.newNode.meta.businessCondition = this.saveBusinessCondition(
        this.businessConditions
      );
      this.newNode.meta.orgCondtion = this.saveBusinessCondition(
        this.departmentConditions
      );
      this.newNode.meta.personCondtion = this.saveBusinessCondition(
        this.employeeConditions
      );
      this.newNode.meta.postionCondtion = this.saveBusinessCondition(
        this.positionsConditions
      );
    },
    ///初始化表单字段
    formInit(tab) {
      if (tab.props.name == "emp") {
        this.InitEmployeeConditions();
      }
      if (tab.props.name == "org") {
        this.InitDepartmentConditions();
      }
      if (tab.props.name == "pos") {
        this.InitPositionConditions();
      }
    },
    ///保存业务条件数据
    saveBusinessCondition(businessConditions) {
      if (businessConditions.length > 0) {
        let business = [];
        businessConditions.forEach((element) => {
          let fields = [];
          if (element.conditions.length > 0) {
            element.conditions.forEach((o) => {
              if (
                o.fieldCode != null &&
                o.fieldCode != "" &&
                o.fieldIn != null &&
                o.fieldIn != ""
              ) {
                fields.push(o);
              }
            });
            if (fields.length > 0)
              business.push({
                areaCode: element.areaCode,
                tableCode: element.tableCode,
                areaLk: element.areaLk,
                areaRk: element.areaRk,
                areaFor: element.areaFor,
                conditions: element.conditions,
              });
          }
        });
        return JSON.stringify(business);
      } else return "";
    },
    ///初始化表单业务字段
    initBusineseFields() {
      this.formLoading = true;
      let url =
        this.apipath +
        "/v1.0/stepfields/" +
        this.formversionid +
        "/" +
        this.flowversionid +
        "/0";
      reqVue.$Post(null, url, this.way).then(
        function (data) {
          if (data.status) {
            let busConditions = this.linkproperty.meta.businessCondition;
            ///当没有条件时
            data.body.areas.forEach((element) => {
              const area = {
                areaCNName: element.areaCNName,
                areaCode: element.areaCode,
                areaENName: element.areaENName,
                mainTableENName: element.mainTableENName,
                mainTable: element.mainTable,
                tableCode: element.tableCode,
                mainTableName: element.mainTableName,
                usable: element.usable,
                conditions:
                  element.conditions == null
                    ? [
                        {
                          fieldCode: "",
                          fieldKey: "",
                          fieldLk: "",
                          fieldRk: "",
                          fieldIn: "",
                          fieldFor: "",
                          cnName: "",
                          enName: "",
                          controlStype: "",
                          controlSouces: "",
                          fieldValue: null,
                          fieldValues: [],
                        },
                      ]
                    : element.conditions,
                areaLk: "",
                areaRk: "",
                areaFor: "",
                fields: element.fields.filter(
                  (o) =>
                    o.controlStype !== "repeat" &&
                    o.controlStype !== "tree" &&
                    o.controlStype !== "image" &&
                    o.controlStype !== "upload" &&
                    o.controlStype !== "records" &&
                    o.controlStype !== "icon" &&
                    o.controlStype !== "radio" &&
                    o.controlStype !== "buttonsType" &&
                    o.controlStype !== "tableinfo" &&
                    o.controlStype !== "avatar"
                ),
              };
              if (busConditions != undefined && busConditions.length > 0) {
                const items = busConditions.filter((o) => o.areaCode == element.areaCode);
                const item = items.length > 0 ? items[0] : null;
                if (item != null) {
                  area.conditions = item.conditions;
                  area.areaLk = item.areaLk;
                  area.areaRk = item.areaRk;
                  area.areaFor = item.areaFor;
                }
              }
              this.businessConditions.push(area);
            });
            this.formLoading = false;
          } else {
            this.$message.error(data.message);
            this.formLoading = false;
          }
        }.bind(this)
      );
    },
    ///弹出系统框
    dialogAddSystemControl(item, area) {
      if (item.controlStype == "employee") {
        let emps = [];
        item.fieldValues.forEach((element) => {
          emps.push({
            empId: element.value,
            cnName: element.cnName,
            enName: element.enName,
          });
        });
        this.$refs.emp.paramters = {
          fieldKey: {
            areaCode: area.areaCode,
            fieldKey: item.fieldKey,
            selectType: 1,
          },
          data: emps,
          exceptDataField: [],
        };
        this.$refs.emp.dialogEmpVisible = true;
        this.$refs.emp.InitData();
      }
      if (item.controlStype == "position") {
        let pos = [];
        item.fieldValues.forEach((element) => {
          pos.push({
            positionId: element.value,
            cnName: element.cnName,
            enName: element.enName,
          });
        });
        this.$refs.pos.paramters = {
          fieldKey: {
            areaCode: area.areaCode,
            fieldKey: item.fieldKey,
            selectType: 1,
          },
          data: pos,
          exceptDataField: [],
        };
        this.$refs.pos.dialogPosVisible = true;
        this.$refs.pos.InitData();
      }
      if (item.controlStype == "organizational") {
        let orgs = [];
        item.fieldValues.forEach((element) => {
          orgs.push({
            id: element.value,
            cnName: element.cnName,
            enName: element.enName,
            orgCode: element.orgCode,
          });
        });
        this.$refs.org.paramters = {
          fieldKey: {
            areaCode: area.areaCode,
            fieldKey: item.fieldKey,
            selectType: 1,
          },
          data: orgs,
          exceptDataField: [],
        };
        this.$refs.org.showCheckBox = true;
        this.$refs.org.dialogOrgVisible = true;
        this.$refs.org.InitData();
      }
      if (item.controlStype == "unit") {
        let orgs = [];
        item.fieldValues.forEach((element) => {
          orgs.push({
            unitId: element.value,
            cnName: element.cnName,
            enName: element.enName,
            unitCode: element.unitCode,
          });
        });
        this.$refs.unit.paramters = {
          fieldKey: {
            areaCode: area.areaCode,
            fieldKey: item.fieldKey,
            selectType: 1,
          },
          data: orgs,
          exceptDataField: [],
        };
        this.$refs.unit.showCheckBox = true;
        this.$refs.unit.dialogOrgVisible = true;
        this.$refs.unit.InitData();
      }
      if (item.controlStype == "parameter") {
        let parameter = [];
        item.fieldValues.forEach((element) => {
          parameter.push({
            parameterCode: element.value,
            cnName: element.cnName,
            enName: element.enName,
          });
        });
        this.$refs.parameter.paramters = {
          fieldKey: {
            areaCode: area.areaCode,
            fieldKey: item.fieldKey,
            selectType: 1,
            parameterCode: item.controlSouces,
          },
          data: parameter,
          exceptDataField: [],
        };
        this.$refs.parameter.showCheckBox = true;
        this.$refs.parameter.dialogParameterVisible = true;
        this.$refs.parameter.InitData();
      }
    },
    ///弹出框返回赋值
    dialogEmpConfirmEvent(res) {
      if (res.result.length > 0) {
        let Conditions = [];
        if (this.$refs["node-tabs-kts"].currentName == "emp") {
          Conditions = this.employeeConditions;
        } else if (this.$refs["node-tabs-kts"].currentName == "org") {
          Conditions = this.departmentConditions;
        } else if (this.$refs["node-tabs-kts"].currentName == "pos") {
          Conditions = this.positionsConditions;
        } else {
          Conditions = this.businessConditions;
        }
        Conditions.forEach((element) => {
          if (element.areaCode == res.key.areaCode) {
            element.conditions.forEach((con) => {
              if (con.fieldKey == res.key.fieldKey) {
                con.fieldValues = [];
                con.fieldValue = [];
                res.result.forEach((re) => {
                  con.fieldValues.push({
                    value: re.empId,
                    cnName: re.cnName,
                    enName: re.enName,
                  });
                });
                res.result.forEach((re) => {
                  con.fieldValue.push(re.empId);
                });
              }
            });
          }
        });
      }
    },
    ///弹出职位框
    dialogPostConfirmEvent(res) {
      if (res.result.length > 0) {
        let Conditions = [];
        if (this.$refs["node-tabs-kts"].currentName == "emp") {
          Conditions = this.employeeConditions;
        } else if (this.$refs["node-tabs-kts"].currentName == "org") {
          Conditions = this.departmentConditions;
        } else if (this.$refs["node-tabs-kts"].currentName == "pos") {
          Conditions = this.positionsConditions;
        } else {
          Conditions = this.businessConditions;
        }
        Conditions.forEach((element) => {
          if (element.areaCode == res.key.areaCode) {
            element.conditions.forEach((con) => {
              if (con.fieldKey == res.key.fieldKey) {
                con.fieldValues = [];
                con.fieldValue = [];
                res.result.forEach((re) => {
                  con.fieldValues.push({
                    value: re.positionId,
                    cnName: re.cnName,
                    enName: re.enName,
                  });
                });
                res.result.forEach((re) => {
                  con.fieldValue.push(re.positionId);
                });
              }
            });
          }
        });
      }
    },
    ///弹出部门框
    dialogOrgConfirmEvent(res) {
      if (res.result.length > 0) {
        let Conditions = [];
        if (this.$refs["node-tabs-kts"].currentName == "emp") {
          Conditions = this.employeeConditions;
        } else if (this.$refs["node-tabs-kts"].currentName == "org") {
          Conditions = this.departmentConditions;
        } else if (this.$refs["node-tabs-kts"].currentName == "pos") {
          Conditions = this.positionsConditions;
        } else {
          Conditions = this.businessConditions;
        }
        Conditions.forEach((element) => {
          if (element.areaCode == res.key.areaCode) {
            element.conditions.forEach((con) => {
              if (con.fieldKey == res.key.fieldKey) {
                con.fieldValues = [];
                con.fieldValue = [];
                res.result.forEach((re) => {
                  con.fieldValues.push({
                    value: re.orgId,
                    cnName: re.cnName,
                    enName: re.enName,
                    orgCode: re.orgCode,
                  });
                });
                res.result.forEach((re) => {
                  con.fieldValue.push(re.orgId);
                });
              }
            });
          }
        });
      }
    },
    ///弹出部门框
    dialogUnitConfirmEvent(res) {
      if (res.result.length > 0) {
        let Conditions = [];
        if (this.$refs["node-tabs-kts"].currentName == "emp") {
          Conditions = this.employeeConditions;
        } else if (this.$refs["node-tabs-kts"].currentName == "org") {
          Conditions = this.departmentConditions;
        } else if (this.$refs["node-tabs-kts"].currentName == "pos") {
          Conditions = this.positionsConditions;
        } else {
          Conditions = this.businessConditions;
        }
        Conditions.forEach((element) => {
          if (element.areaCode == res.key.areaCode) {
            element.conditions.forEach((con) => {
              if (con.fieldKey == res.key.fieldKey) {
                con.fieldValues = [];
                con.fieldValue = [];
                res.result.forEach((re) => {
                  con.fieldValues.push({
                    value: re.unitId,
                    cnName: re.cnName,
                    enName: re.enName,
                    orgCode: re.unitCode,
                  });
                });
                res.result.forEach((re) => {
                  con.fieldValue.push(re.unitId);
                });
              }
            });
          }
        });
      }
    },
    dialogParameterConfirmEvent(res) {
      if (res.result.length > 0) {
        let Conditions = [];
        if (this.$refs["node-tabs-kts"].currentName == "emp") {
          Conditions = this.employeeConditions;
        } else if (this.$refs["node-tabs-kts"].currentName == "org") {
          Conditions = this.departmentConditions;
        } else if (this.$refs["node-tabs-kts"].currentName == "pos") {
          Conditions = this.positionsConditions;
        } else {
          Conditions = this.businessConditions;
        }
        Conditions.forEach((element) => {
          if (element.areaCode == res.key.areaCode) {
            element.conditions.forEach((con) => {
              if (con.fieldKey == res.key.fieldKey) {
                con.fieldValues = [];
                con.fieldValue = [];
                res.result.forEach((re) => {
                  con.fieldValues.push({
                    value: re.parameterCode,
                    cnName: re.cnName,
                    enName: re.enName,
                    parameterCode: re.parameterCode,
                  });
                });
                res.result.forEach((re) => {
                  con.fieldValue.push(re.parameterCode);
                });
              }
            });
          }
        });
      }
    },
    ///添加单个条件
    addConds(conditions) {
      conditions.push({
        fieldCode: "",
        fieldKey: "",
        fieldLk: "",
        fieldRk: "",
        fieldIn: "",
        fieldFor: "",
        cnName: "",
        enName: "",
        controlStype: "",
        controlSouces: "",
        fieldValue: null,
        fieldValues: [],
        personType: 0,
      });
    },
    removeConds(conditions, index) {
      conditions.splice(index, 1);
      if (conditions.length === 0) this.addConds(conditions);
    },
    changeFields(condit, fields) {
      condit.fieldIn = "";
      condit.fieldValue = null;
      condit.fieldValues = [];
      let field = fields.filter((o) => o.fieldKey == condit.fieldKey);
      if (field.length > 0) {
        condit.controlStype = field[0].controlStype;
        condit.fieldCode = field[0].fieldCode;
        condit.controlSouces = field[0].controlSouces;
      }
    },
    changeFieldsIn(condit) {
      condit.fieldValue = null;
      condit.fieldValues = [];
    },
    ///员工信息条件
    InitEmployeeConditions() {
      if (
        this.employeeConditions == undefined ||
        this.employeeConditions.length == 0 ||
        this.employeeConditions == null
      ) {
        this.formLoading = true;
        this.query = {};
        this.query.page = 1;
        this.query.pageSize = 1000;
        this.query.paramters = [];
        this.query.paramters.push({
          label: "tablecode",
          value: "employee",
        });
        this.query.useDisabledData = false;
        reqVue.$Post(this.query, "field/v1.0/pages", "business").then(
          function (data) {
            if (data.status) {
              let personCondtion = this.linkproperty.meta.personCondtion;
              ///当没有条件时
              let fields = [];
              data.body.body
                .filter(
                  (o) =>
                    o.controlStype !== "repeat" &&
                    o.controlStype !== "tree" &&
                    o.controlStype !== "image" &&
                    o.controlStype !== "upload" &&
                    o.controlStype !== "records" &&
                    o.controlStype !== "icon" &&
                    o.controlStype !== "radio" &&
                    o.controlStype !== "buttonsType" &&
                    o.controlStype !== "tableinfo" &&
                    o.controlStype !== "avatar"
                )
                .forEach((o) => {
                  fields.push({
                    cnName: o.fieldName,
                    enName: o.fieldENName,
                    fieldCode: o.fieldCode,
                    fieldKey: "basic_employee_info$employee$" + o.fieldCode,
                    controlStype: o.controlStype,
                    controlSouces: o.controlSouces,
                  });
                });
              const area = {
                areaCNName: "员工基本信息",
                areaCode: "basic_employee_info",
                areaENName: "Employee Info",
                tableCode: "employee",
                conditions: [
                  {
                    fieldCode: "",
                    fieldKey: "",
                    fieldLk: "",
                    fieldRk: "",
                    fieldIn: "",
                    fieldFor: "",
                    cnName: "",
                    enName: "",
                    controlStype: "",
                    controlSouces: "",
                    fieldValue: null,
                    fieldValues: [],
                    personType: "0",
                  },
                ],
                areaLk: "",
                areaRk: "",
                areaFor: "",
                fields: fields,
              };
              if (personCondtion != undefined && personCondtion.length > 0) {
                const item = personCondtion.length > 0 ? personCondtion[0] : null;
                if (item != null) {
                  area.conditions = item.conditions;
                  area.areaLk = item.areaLk;
                  area.areaRk = item.areaRk;
                  area.areaFor = item.areaFor;
                }
              }
              this.employeeConditions.push(area);
              this.formLoading = false;
            } else {
              this.$message.error(data.message);
              this.formLoading = false;
            }
          }.bind(this)
        );
      }
    },
    ///组织信息条件
    InitDepartmentConditions() {
      if (
        this.departmentConditions == undefined ||
        this.departmentConditions.length == 0 ||
        this.departmentConditions == null
      ) {
        this.formLoading = true;
        this.query = {};
        this.query.page = 1;
        this.query.pageSize = 1000;
        this.query.paramters = [];
        this.query.paramters.push({
          label: "tablecode",
          value: "organization",
        });
        this.query.useDisabledData = false;
        reqVue.$Post(this.query, "field/v1.0/pages", "business").then(
          function (data) {
            if (data.status) {
              let orgCondtion = this.linkproperty.meta.orgCondtion;
              ///当没有条件时
              let fields = [];
              data.body.body
                .filter(
                  (o) =>
                    o.controlStype !== "repeat" &&
                    o.controlStype !== "tree" &&
                    o.controlStype !== "image" &&
                    o.controlStype !== "upload" &&
                    o.controlStype !== "records" &&
                    o.controlStype !== "icon" &&
                    o.controlStype !== "radio" &&
                    o.controlStype !== "buttonsType" &&
                    o.controlStype !== "tableinfo" &&
                    o.controlStype !== "avatar"
                )
                .forEach((o) => {
                  fields.push({
                    cnName: o.fieldName,
                    enName: o.fieldENName,
                    fieldCode: o.fieldCode,
                    fieldKey: "basic_organization_info$organization$" + o.fieldCode,
                    controlStype: o.controlStype,
                    controlSouces: o.controlSouces,
                  });
                });
              const area = {
                areaCNName: "组织信息",
                areaCode: "basic_organization_info",
                areaENName: "Organize Info",
                tableCode: "organization",
                conditions: [
                  {
                    fieldCode: "",
                    fieldKey: "",
                    fieldLk: "",
                    fieldRk: "",
                    fieldIn: "",
                    fieldFor: "",
                    cnName: "",
                    enName: "",
                    controlStype: "",
                    controlSouces: "",
                    fieldValue: null,
                    fieldValues: [],
                    personType: "0",
                  },
                ],
                areaLk: "",
                areaRk: "",
                areaFor: "",
                fields: fields,
              };
              if (orgCondtion != undefined && orgCondtion.length > 0) {
                const item = orgCondtion.length > 0 ? orgCondtion[0] : null;
                if (item != null) {
                  area.conditions = item.conditions;
                  area.areaLk = item.areaLk;
                  area.areaRk = item.areaRk;
                  area.areaFor = item.areaFor;
                }
              }
              this.departmentConditions.push(area);
              this.formLoading = false;
            } else {
              this.$message.error(data.message);
              this.formLoading = false;
            }
          }.bind(this)
        );
      }
    },
    ///职位信息条件
    InitPositionConditions() {
      if (
        this.positionsConditions == undefined ||
        this.positionsConditions.length == 0 ||
        this.positionsConditions == null
      ) {
        this.formLoading = true;
        this.query = {};
        this.query.page = 1;
        this.query.pageSize = 1000;
        this.query.paramters = [];
        this.query.paramters.push({
          label: "tablecode",
          value: "position",
        });
        this.query.useDisabledData = false;
        reqVue.$Post(this.query, "field/v1.0/pages", "business").then(
          function (data) {
            if (data.status) {
              let orgCondtion = this.linkproperty.meta.postionCondtion;
              ///当没有条件时
              let fields = [];
              data.body.body
                .filter(
                  (o) =>
                    o.controlStype !== "repeat" &&
                    o.controlStype !== "tree" &&
                    o.controlStype !== "image" &&
                    o.controlStype !== "upload" &&
                    o.controlStype !== "records" &&
                    o.controlStype !== "icon" &&
                    o.controlStype !== "radio" &&
                    o.controlStype !== "buttonsType" &&
                    o.controlStype !== "tableinfo" &&
                    o.controlStype !== "avatar"
                )
                .forEach((o) => {
                  fields.push({
                    cnName: o.fieldName,
                    enName: o.fieldENName,
                    fieldCode: o.fieldCode,
                    fieldKey: "basic_position_info$position$" + o.fieldCode,
                    controlStype: o.controlStype,
                    controlSouces: o.controlSouces,
                  });
                });
              const area = {
                areaCNName: "职位信息",
                areaCode: "basic_position_info",
                areaENName: "Position Info",
                tableCode: "position",
                conditions: [
                  {
                    fieldCode: "",
                    fieldKey: "",
                    fieldLk: "",
                    fieldRk: "",
                    fieldIn: "",
                    fieldFor: "",
                    cnName: "",
                    enName: "",
                    controlStype: "",
                    controlSouces: "",
                    fieldValue: null,
                    fieldValues: [],
                    personType: "0",
                  },
                ],
                areaLk: "",
                areaRk: "",
                areaFor: "",
                fields: fields,
              };
              if (orgCondtion != undefined && orgCondtion.length > 0) {
                const item = orgCondtion.length > 0 ? orgCondtion[0] : null;
                if (item != null) {
                  area.conditions = item.conditions;
                  area.areaLk = item.areaLk;
                  area.areaRk = item.areaRk;
                  area.areaFor = item.areaFor;
                }
              }
              this.positionsConditions.push(area);
              this.formLoading = false;
            } else {
              this.$message.error(data.message);
              this.formLoading = false;
            }
          }.bind(this)
        );
      }
    },
    clearValue(value, item) {
      item.fieldValues = item.fieldValues.filter((o) => o.value !== value);
    },
  },
  mounted() {
    window.addEventListener("resize", this.getHeight);
    this.getHeight();
  },
  components: {
    DialogEmployeeComponetVue,
    DialogPositionComponetVue,
    DialogOrgComponetVue,
    DialogParameterComponetVue,
    DialogUnitComponetVue,
  },
};
</script>
